package v1

import (
	"github.com/gogf/gf/v2/frame/g"
	"ruoyi-vue-pro-go/api/common"
	"ruoyi-vue-pro-go/internal/model/entity"
)

type GetOneReq struct {
	g.Meta `path:"/admin-api/system/role/get" method:"get" tags:"role" permission:"system:role:query" summary:"Get one role"`
	Id     int64 `v:"required" dc:"role id"`
}
type GetOneRes struct {
	*entity.SystemRole `dc:"role"`
}
type GetListReq struct {
	g.Meta `path:"/admin-api/system/role/simple-list" method:"get" tags:"role" summary:"Get role list"`
}
type GetListRes struct {
	List []*entity.SystemRole `json:"list" dc:"role list"`
}

type GetListByUserIdReq struct {
	UserId int64 `json:"user_id" dc:"user id"`
}
type GetListByUserIdRes struct {
	List []*entity.SystemRole `json:"list" dc:"role list"`
}

type GetPageReq struct {
	g.Meta `path:"/admin-api/system/role/page" method:"get" tags:"role Page" summary:"Get role pages"`
	*common.CommonPageReq
	Name       string   `json:"name" dc:"name"`
	Code       string   `json:"code" dc:"code"`
	Status     int      `json:"status" dc:"status"`
	CreateTime []string `json:"create_time" dc:"create time"`
}
type GetPageRes struct {
	List []*entity.SystemRole `json:"list" dc:"role pages"`
	*common.CommonPageRes
}

type UpdateReq struct {
	g.Meta           `path:"/admin-api/system/role/{id}" method:"put" tags:"role" permission:"system:role:update" summary:"Update role"`
	Id               int64  `v:"required" dc:"role id"`
	Name             string `v:"required" dc:"role name"`
	Code             string `v:"required" dc:"role code"`
	Sort             int    `v:"required" dc:"显示顺序"`
	DataScope        int    `dc:"数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）"`
	DataScopeDeptIds string `dc:"数据范围(指定部门数组)"`
	Type             int    `dc:"角色类型"`
	Remark           string `dc:"role remark"`
	Status           int    `v:"required|in 0,1" dc:"role status"`
	TenantId         int64  `dc:"role tenant id"`
	Creator          string `dc:"role creator"`
	Updater          string `dc:"role updater"`
}
type UpdateRes struct{}

type CreateReq struct {
	g.Meta           `path:"/admin-api/system/role/create" method:"post" tags:"role" permission:"system:role:create" summary:"Create role"`
	Id               int64  `dc:"role id"`
	Name             string `v:"required" dc:"role name"`
	Code             string `v:"required" dc:"role code"`
	Sort             int    `v:"required" dc:"显示顺序"`
	DataScope        int    `dc:"数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）"`
	DataScopeDeptIds string `dc:"数据范围(指定部门数组)"`
	Type             int    `dc:"角色类型"`
	Remark           string `dc:"role remark"`
	Status           int    `v:"required|in 0,1" dc:"role status"`
	TenantId         int64  `dc:"role tenant id"`
	Creator          string `dc:"role creator"`
	Updater          string `dc:"role updater"`
}
type CreateRes struct{}

type DeleteReq struct {
	g.Meta `path:"/admin-api/system/role/delete" method:"delete" tags:"role" permission:"system:role:delete" summary:"Delete role"`
	Id     int64 `v:"required"`
}
type DeleteRes struct{}

type DeleteListReq struct {
	g.Meta `path:"/admin-api/system/role/delete-list" method:"delete" tags:"role" permission:"system:role:delete" summary:"Delete role list"`
	Ids    string `v:"required"`
}
type DeleteListRes struct{}

type ExportExcelReq struct {
	g.Meta `path:"/admin-api/system/role/export-excel" method:"get" tags:"role" permission:"system:role:export" summary:"Export role excel"`
}
type ExportExcelRes struct {
	g.Meta `mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" type:"string" example:"<file content>"`
}

type AssignRoleDataScopeReq struct {
	g.Meta    `path:"/admin-api/system/permission/assign-role-data-scope" method:"post" tags:"role" permission:"system:permission:assign-role-data-scope" summary:"Assign role data scope"`
	RoleId    int64 `v:"required" dc:"role id"`
	DataScope int64 `v:"required" dc:"data scope"`
}
type AssignRoleDataScopeRes struct{}
